//package com.example.bsxk.security;
//
//import com.alibaba.druid.sql.visitor.functions.If;
//import com.example.bsxk.dao.UserDao;
//import com.example.bsxk.entity.User;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.security.core.authority.AuthorityUtils;
//import org.springframework.security.core.userdetails.UserDetails;
//import org.springframework.security.core.userdetails.UserDetailsService;
//import org.springframework.security.core.userdetails.UsernameNotFoundException;
//import org.springframework.stereotype.Component;
//
////查询用户信息
//@Component
//public class BsxtUserDetailService implements UserDetailsService {
//    @Autowired
//    UserDao userDao;
//    @Override
//    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
//        User user=userDao.findByName(username);
//        if (user == null){
//            throw new RuntimeException("用户不存在");
//        }
//        UserDetails userDetails = org.springframework.security.core.userdetails.User.builder().username(username)
//                .password(user.getPassword()).authorities(AuthorityUtils.NO_AUTHORITIES).build();
//        return userDetails;
//    }
//}
